check wx_uid for api wx_balance_withdraw_api

Brightcells 8 年之前
父節點
當前提交
92da943e9e
共有 3 個文件被更改,包括 6 次插入2 次删除
  1. 1 1
      account/admin.py
  2. 3 0
      pay/views.py
  3. 2 1
      utils/error/errno_utils.py

+ 1 - 1
account/admin.py

@@ -49,7 +49,7 @@ class LensmanIncomeExpensesInfoAdmin(admin.ModelAdmin):
49 49
 
50 50
 class UserInfoAdmin(admin.ModelAdmin):
51 51
     readonly_fields = ('user_id', )
52
-    list_display = ('user_id', 'user_from', 'username', 'wx_uid', 'name', 'sex', 'nickname', 'phone', 'location', 'user_status', 'status', 'created_at', 'updated_at')
52
+    list_display = ('user_id', 'user_from', 'username', 'wx_uid', 'name', 'sex', 'nickname', 'phone', 'location', 'balance', 'user_status', 'status', 'created_at', 'updated_at')
53 53
     search_fields = ('name', 'phone', 'location')
54 54
     list_filter = ('user_from', 'sex', 'user_status', 'status')
55 55
 

+ 3 - 0
pay/views.py

@@ -346,6 +346,9 @@ def wx_balance_withdraw_api(request):
346 346
     withdraw_type = request.POST.get('withdraw_type', 'TRANSFER')
347 347
     amount = int(request.POST.get('amount', 0))
348 348
 
349
+    if not user.wx_uid:
350
+        return response(WithdrawStatusCode.OPENID_NOT_FOUND)
351
+
349 352
     if user.balance < amount:
350 353
         return response(WithdrawStatusCode.BALANCE_NOT_ENOUGH)
351 354
 

+ 2 - 1
utils/error/errno_utils.py

@@ -77,7 +77,8 @@ class OrderStatusCode(BaseStatusCode):
77 77
 
78 78
 class WithdrawStatusCode(BaseStatusCode):
79 79
     """ 提现相关错误码 4041xx """
80
-    BALANCE_NOT_ENOUGH = StatusCodeField(404100, u'Balance Not Enough', description=u'提现金额不足')
80
+    OPENID_NOT_FOUND = StatusCodeField(404100, u'OPENID Not Found', description=u'微信 OPENID 不存在')
81
+    BALANCE_NOT_ENOUGH = StatusCodeField(404101, u'Balance Not Enough', description=u'提现金额不足')
81 82
 
82 83
 
83 84
 class MessageStatusCode(BaseStatusCode):